<script>
    /*数据-删除*/
    function data_del(obj, url, id) {
        layer.confirm('确认要删除吗？', function (index) {
            //发异步删除数据
            $.get(url, { id: id }, function (data) {
                if (data.code == 0) {
                    $(obj).parents("tr").remove();
                    $("#count").text($("#count").text() - 1);
                    layer.msg(data.msg, { icon: 1, time: 1000 });
                } else {
                    layer.msg(data.msg, { icon: 2, time: 1000 });
                }
            }, 'json');
        });
    }

    /*数据-状态*/
    function data_status(title, obj, url, id, status) {
        layer.confirm(title, function (index) {
            //发异步删除数据
            $.get(url, { id: id, status: status }, function (data) {
                if (data.code == 0) {
                    layer.msg(data.msg, { icon: 6, time: 1000 }, function () {
                        location.reload();
                        layer.close();
                    });
                } else {
                    layer.msg(data.msg, { icon: 2, time: 1000 });
                }
            }, 'json');
        });
    }

    /*数据编辑*/
    function data_edit(title, url) {
        if (/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
            // pe
        } else {
            // pc
        }
        xadmin.open(title, url);
    }

    /*当你在iframe页面关闭自身时*/
    function IframeClose() {
        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
        parent.layer.close(index); //再执行关闭 
    }

    function showimg(imgs) {
        layer.open({
            type: 1,
            title: false,
            shadeClose: true,
            skin: 'layui-layer-nobg', //没有背景色
            content: "<img src='" + imgs + "' style='width:100%;height: 100%;'>"
        });
    }


</script>

</html>